package com.enjoyor.soa.traffic.core.efoms.mapper.impl;

import com.enjoyor.soa.traffic.core.efoms.constant.WorkordersInfoSqlId;
import com.enjoyor.soa.traffic.core.efoms.domain.WorkordersInfo;
import com.enjoyor.soa.traffic.core.efoms.mapper.IWorkordersInfoMapper;
import com.enjoyor.soa.traffic.frame.support.mybatis.mapper.impl.BaseMapper;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class WorkordersInfoMapper extends BaseMapper<WorkordersInfo> implements IWorkordersInfoMapper {

    @Override
    public List<WorkordersInfo> selectWorkordersInfoList(Map<String, Object> map){
    	return sqlSessionTemplate.selectList(getSqlName(WorkordersInfoSqlId.SQL_SELECT_LIST), map);
    }

    /**
     * 查询当前逾期工单数量
     *
     * @return
     */
    @Override
    public int countOverTimeWorkOder() {
        return sqlSessionTemplate.selectOne(getSqlName(WorkordersInfoSqlId.SQL_COUNT_OVER_TIME_WORKORDER));
    }

    /**
     * 维修待确认工单数量查询并推送
     *
     * @return
     */
    @Override
    public int countSureWKorderInfo(Map<String, Object> map) {
        return sqlSessionTemplate.selectOne(getSqlName(WorkordersInfoSqlId.SQL_COUNT_SURE_WORKORDER),map);
    }

    /**
     * 维修反馈工单数量查询并推送
     *
     * @return
     */
    @Override
    public int countFackbackWKorderInfo(Map<String, Object> map) {
        return sqlSessionTemplate.selectOne(getSqlName(WorkordersInfoSqlId.SQL_COUNT_FACKBACK_WKORDER), map);
    }

    /**
     * 维修今日催办工单数量查询并推送
     *
     * @return
     */
    @Override
    public int countPressWKorderInfo(Map<String, Object> map) {
        return sqlSessionTemplate.selectOne(getSqlName(WorkordersInfoSqlId.SQL_COUNT_PRESS_WKORDER), map);
    }

    /**
     * 维修今日申请延期工单数量查询并推送
     *
     * @return
     */
    @Override
    public int countPostponeWKorderInfo(Map<String, Object> map) {
        return sqlSessionTemplate.selectOne(getSqlName(WorkordersInfoSqlId.SQL_COUNT_POSTPONE_WKORDER), map);
    }

    /**
     * 维修工单驳回工单数量统计并推送
     *
     * @return
     */
    @Override
    public int countRejectWKorderInfo(Map<String, Object> map) {
        return sqlSessionTemplate.selectOne(getSqlName(WorkordersInfoSqlId.SQL_COUNT_REJECT_WKORDER), map);
    }

}
